﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using DBLayer;

namespace BALayer
{
    public class DBHocKy
    {
        DAL db = null;
        public DBHocKy()
        {
            db = new DAL();
        }
        //Lay Hoc Ky
        public DataSet LayHocKy()
        {
            return db.ExecuteQueryDataSet("Select * From HocKy", CommandType.Text, null);
        }
        //Them Hoc Ky
        public bool ThemHocKy(ref string err, string MaHocKy, string HocKy)
        {
            return db.MyExecuteNonQuery("SpThemHocKy", CommandType.StoredProcedure, ref err,
                new SqlParameter("@MaHocKy", MaHocKy),
                new SqlParameter("@HocKy", HocKy));
        }
        //Xoa Hoc Ky
        public bool XoaHocKy(ref string err, string MaHocKy)
        {
            return db.MyExecuteNonQuery("SpXoaHocKy", CommandType.StoredProcedure, ref err, new SqlParameter("@MaHocKy", MaHocKy));
        }
        //Cap nhat Hoc Ky
        public bool CapNhatHocKy(ref string err, string MaHocKy, string HocKy)
        {
            return db.MyExecuteNonQuery("SpCapNhatHocKy", CommandType.StoredProcedure, ref err,
                new SqlParameter("@MaHocKy", MaHocKy),
                new SqlParameter("@HocKy", HocKy));
        }
    }
}
